define('frender3x/app/AppMap',
[
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/on',

    'esri/map',
    'esri/layers/ArcGISTiledMapServiceLayer',
    'esri/Evented',

    'keepsoft/gis/extlayers/GoogleTiledMapServiceLayer',

    'frender3x/app/FRender'
],
function(declare, lang, on,
         Map, ArcGISTiledMapServiceLayer, GoogleTiledMapServiceLayer, Evented,
        FRender){
    var d = declare([Evented], {
        _eventMap:{
            'tile-loaded':!0
        },
        constructor:function(mapdiv, opt){
            this.options = {};
            this.map = new Map(mapdiv, {
                center:opt.center,
                zoom:opt.zoom,
                logo:false
            });
        },
        init:function(){
            this.map.on('load', lang.hitch(this, this._tileLoad));
            var tile = new ArcGISTiledMapServiceLayer('http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer');

            this.baseTileLayer = tile;
            this.map.addLayer(tile);


        },
        _tileLoad:function(){
            console.log('tile load');
            //var tile2 = new ArcGISTiledMapServiceLayer('http://192.168.1.74/ArcGIS/rest/services/20160219/MapServer');
            //this.map.addLayer(tile2);
            this.buildComponents();
        },
        buildComponents:function(){
            var frender = new FRender(this.map, {
                imgSize:[4467, 4271],
                imgScale:15000

            });
            this.frender = frender;
            frender.setLods(this.baseTileLayer.tileInfo.lods);
            this.onTileLoaded();
        },
        /* 质朴长存法  by lifesinger */
        pad:function(num, n) {
            var len = num.toString().length;
            while(len < n) {
                num = "0" + num;
                len++;
            }
            return num;
        },
        onTileLoaded:function(){

        }
    });
    return d;
})